#!/usr/bin/expect -f
#用途:远程复制文件
set user [lindex $argv 0]
set host [lindex $argv 1]
set password [lindex $argv 2]
set locaFile [lindex $argv 3]
set targetPath [lindex $argv 4]

spawn scp $locaFile $user@$host:$targetPath
#spawn $cmd
set timeout 300
expect "$user@$host's password:"
set timeout 300         
send "$password\r"
set timeout 300 
send "exit\r"
expect eof

